#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>
#include<cmath>
using namespace std;

int jie(int x);
double sin(int x);

int main()
{
    double k;
    int r, s;
    cout << "r = ";
    cin >> r;
    cout << "s = ";
    cin >> s;

    if (pow(r, 2) <= pow(s, 2))
    {
        double temp = pow(sin(r), 2) + pow(sin(s), 2);
        k = sqrt(temp);
    }
    else if (pow(r, 2) > pow(s, 2))
    {
        k = sin(r * s) / 2;
    }

    cout << "k = " << k;

    return 0;
}

int jie(int x)
{
    if (x == 0 || x == 1)
    {
        return 1;
    }
    else
    {
        return jie(x - 1) * x;
    }
}

double sin(int x)
{
    double result = 0;
    int sign = 1;
    double line = 1e-6;

    for (int n = 0;; n++)
    {
        double temp = sign * pow(x, 2 * n + 1) / jie(2 * n + 1);
        if (fabs(temp) < line)
        {
            break;
        }
        result += temp;
        sign *= -1;
    }

    return result;
}